package Test;

import java.io.File;
import java.io.FileFilter;

public class Test2 {
    public static void main(String[] args) {
        File dir = new File(".");
        if(dir.isDirectory()){
//            File[] subs = dir.listFiles(new FileFilter() {  //创建数组方面遍历输出
//                @Override
//                public boolean accept(File pathname) {
//                    return pathname.getName().contains("s");
//                }
            File[] subs = dir.listFiles((pathname) -> pathname.getName().contains("s"));
            for (File f:subs
                 ) {
                System.out.println(f.getName());
            }
        }
    }
}
